# 集合 可变

s = {2,5,6,66,6,8,89}
print(s)

# 内置set()
s1=set(range(6))
print(s1)

s4=set('python')
print(s4)

# 生成式
s = { i**2 for i in range(10)}
print(s)

print('比较相等，子集，超集，是否有交集')
s= {10,20,30,40}
s2={40,20,30,10}
print(s ==s2)
print(s !=s2)

print({10}.issubset(s))
print({10}.issuperset(s))
print({10}.isdisjoint(s))
# True
# False
# False

print("集合的操作")
s1={10,20,30,40}
s2={20,30,40,50,60}
print(s1.intersection(s2))
print(s1 &s2)

print(s1.union(s2))
print(s1 | s2)

#(3)差集操作
print(s1-s2)
print(s.difference(s2))

#（4）对称差集
print(s1.symmetric_difference(s2))
print(s1^s2)

